﻿#pragma once

#include <vector>

namespace C = ClientPackets;
namespace S = ServerPackets;

class Packet
{
public:
    static bool IsServer;

    virtual short getIndex() const = 0;

    static Packet *ReceivePacket(std::vector<unsigned char> &rawBytes, std::vector<unsigned char> &extra);

    std::vector<unsigned char> GetPacketBytes();

protected:
    virtual void ReadPacket(BinaryReader *reader) = 0;
    virtual void WritePacket(BinaryWriter *writer) = 0;

private:
    static Packet *GetClientPacket(short index);
public:
    static Packet *GetServerPacket(short index);
};
